home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / Application.java < prev    next >
Text File  |  1998-09-29  |  2KB  |  69 lines

  1. /*
  2. import com.symantec.itools.vcafe.macro.VisualCafeCommand;
  3.  
  4.  //    Visual Cafe Application Event Macros
  5.  //
  6.  //    appStart()   - Executed when VCafe is launched.
  7.  //    appExit()    - Executed when VCafe is exited.
  8.  //    backupFile() - Executed if backupFile is set active under the
  9.  //                   menu item Tools | Environment Options |Backup
  10.  //
  11.  
  12. public class Application
  13. {
  14.     public Application() {}
  15.  
  16.     // All macros need public void run() to be loaded and executed by the macro system.
  17.     public void run()
  18.     {
  19.     }
  20.  
  21.     
  22.     // appStart() gets executed when VCafe is first loaded.
  23.     public void appStart()
  24.     {
  25.          System.out.println("Application.appStart() --- Executed.");
  26.     }
  27.  
  28.     
  29.     //appExit() gets executed when VCafe exits.
  30.     public void appExit()
  31.     {
  32.         String sOutFileName = "c:/temp/VCafe_appExitTest.txt";
  33.  
  34.          System.out.println("Application.appExit() --- Going to exit, C-Ya! ...");
  35.          java.util.Date dTime = new java.util.Date();
  36.          java.io.File fOut;
  37.          java.io.FileWriter fwOut;
  38.          java.io.PrintWriter pwOut = null;
  39.  
  40.          try
  41.          {
  42.             fOut = new java.io.File(sOutFileName);
  43.             fwOut = new java.io.FileWriter(fOut);
  44.             pwOut = new java.io.PrintWriter(fwOut);
  45.             pwOut.println("Test for Visual Cafe appExit() method.");
  46.             pwOut.println("This file can be deleted.");
  47.             pwOut.println(dTime.toString());
  48.         }
  49.         catch(java.io.IOException ioe)
  50.         {
  51.             ioe.printStackTrace();
  52.         }
  53.         finally
  54.         {
  55.             if(pwOut != null) pwOut.close();
  56.         }
  57.     }
  58.  
  59.     //     If Tools -> Environment Options -> Backup ->
  60.     //       "Backup files on Save" -> "Invoke bakcupFile() macro method is selected,
  61.     //       this method will execute when a backup event occurs.
  62.     public void backupFile(String sDir, String sFile)
  63.     {
  64.          System.out.println("Application.backupFile() --- Executed.");
  65.          System.out.println("    Directory: "+sDir);
  66.          System.out.println("    File: "+sFile);
  67.     }
  68. }
  69. */